/////////////////////////////////////////////////////////////////////////
//
// Amuse Engine SDK - core/geometry
// Copyright( c) 2013.  All Rights Reserved
//
// File:		AEPlane.inl
// Author:		Gianluca Belardelli
// Date:		04/10/2013
//
/////////////////////////////////////////////////////////////////////////
#ifndef _AEPLANE_INL_
#define _AEPLANE_INL_

AE_FORCEINLINE AEPlane::AEPlane( void ) { }
AE_FORCEINLINE AEPlane::AEPlane( const AEVector3 &vcNormal, const float fDistance )
{
	m_vcNormalDist.fX = vcNormal.fX;
	m_vcNormalDist.fY = vcNormal.fY;
	m_vcNormalDist.fZ = vcNormal.fZ;
	m_vcNormalDist.fW = fDistance;
	_normalize();
}

AE_FORCEINLINE AEPlane::AEPlane( float fNormalX, float fNormalY, float fNormalZ, float fDistance )
{
	m_vcNormalDist.fX = fNormalX;
	m_vcNormalDist.fY = fNormalY;
	m_vcNormalDist.fZ = fNormalZ;
	m_vcNormalDist.fW = fDistance;
	_normalize();
}

AE_FORCEINLINE AEPlane::AEPlane( const AEPlane &copy )
{
	m_vcNormalDist = copy.m_vcNormalDist;
}

AE_FORCEINLINE void AEPlane::SetNormal( const AEVector3 &vcNormal )
{
	m_vcNormalDist.fX = vcNormal.fX;
	m_vcNormalDist.fY = vcNormal.fY;
	m_vcNormalDist.fZ = vcNormal.fZ;
	_normalize();
}

AE_FORCEINLINE void AEPlane::SetNormal( float fX, float fY, float fZ )
{
	m_vcNormalDist.fX = fNormalX;
	m_vcNormalDist.fY = fNormalY;
	m_vcNormalDist.fZ = fNormalZ;
	_normalize();
}

AE_FORCEINLINE void AEPlane::SetDistance( float fDistance )
{
	m_vcNormalDist.fW = fDistance;
}

AE_FORCEINLINE bool AEPlane::Intersects( const AEBoundingBox &bbTestBox ) const
{
	return bbTestBox.Intersect( *this );
}

AE_FORCEINLINE bool AEPlane::Intersects( const AEBoundingSphere &bsTestSphere ) const
{
	return bsTestSphere.Intersect( *this );
}

AE_FORCEINLINE bool AEPlane::IsValid( void ) const
{
	return m_vcNormalDist.isValid();
}

AE_FORCEINLINE bool AEPlane::IsEmpty( void ) const
{
}

AE_FORCEINLINE const AEVector3 &AEPlane::GetNormal( void ) const
{
	return AEVector3( m_vcNormalDist.fX, m_vcNormalDist.fY, m_vcNormalDist.fZ );
}

AE_FORCEINLINE float AEPlane::GetDistance( void ) const
{
	return m_vcNormalDist.fW;
}

#endif // _AEPLANE_INL_
